<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../../../static/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../../static/js/jquery.js"></script>
<script type="text/javascript" src="../../../static/js/getProvinceAmdCity.js"></script>
<script type="text/javascript">
  let user = JSON.parse(localStorage.getItem("user"));
  var addFirm = {
    firmName:null,
    firmFounder:null,
    firmTel:null,
    firmAddress:null,
    firmCity:null,
    firmContent:null,
    status:null,
    createId:null,
    createTime:null
  }

  function getParamAddFirm() {
    var cityId = $("#firmAdd_City").val();
    if (cityId === "请选择"){
      cityId = null;
    }

    addFirm = {
      firmName:$("#firmAdd_Name").val(),
      firmFounder:$("#frimAdd_Founder").val(),
      firmTel:$("#frimAdd_Tel").val(),
      firmAddress:$("#frimAdd_Address").val(),
      firmCity:cityId,
      firmContent:$("#firmAdd_Des").val(),
      status:$("#firmAdd_Status").val(),
      createId:user.uid,
      createTime:$("#firmAdd_CreateTime").val()
    }
  }

  $(function () {
    getAddressInfo();
    $("#firmAdd_CreateName").val(user.uname);
    var time = new Date();
    $("#firmAdd_CreateTime").val(time.toLocaleString());
  })

  function addCFirm() {
    getParamAddFirm();
    var isTrue = confirm("确认添加吗？");
    if (isTrue) {
      $.ajax({
        url:"/manufacturer/addProductFirm",
        method:"post",
        data:addFirm,
        dataType:"JSON",
        success: function (rel) {
          if (rel.data) {
            window.location.href = "cflist";
          }
        }
      })
    }
  }

</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li>厂商管理</li>
    <li>添加</li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>厂商信息</span></div>
  <ul class="forminfo">
    <li>
      <label>厂商名称</label>
      <input id="firmAdd_Name" type="text" class="dfinput" />
      <i>必填，不能超过50个字符</i>
    </li>
    <li>
      <label>负责人</label>
      <input id="frimAdd_Founder" type="text" class="dfinput" />
       <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>联系方式</label>
      <input id="frimAdd_Tel" type="text" class="dfinput" />
       <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>联系地址</label>
      <input id="frimAdd_Address" type="text" class="dfinput" />
       <i>必填，不能超过130个字符</i>
    </li>
    <li>
      <label>所属区域</label>
      <select class="dfProvince" onchange="provinceChange()" id="firmAdd_province">
          <option>请选择</option>
<!--          <option>北京</option>-->
<!--          <option>江苏</option>-->
<!--          <option>天津</option>-->
      </select>
      省
      <select id="firmAdd_City" class="dfCity">
          <option>请选择</option>
<!--          <option>北京</option>-->
<!--          <option>南京</option>-->
<!--          <option>天津</option>-->
      </select>
      市
      <i>必选</i>
    </li>
    <li>
      <label>描述</label>
      <textarea id="firmAdd_Des" class="textinput"></textarea>
      <i>可选</i>
    </li>
    <li>
      <label>状态</label>
      <select id="firmAdd_Status" class="dfselect">
          <option value="1">可用</option>
          <option value="2">不可用</option>
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>创建人</label>
      <input id="firmAdd_CreateName" type="text" value="马云" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>创建时间</label>
      <input id="firmAdd_CreateTime" type="text" value="2017-11-18 15:36:10" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input name="" type="button" class="btn" value="确定" onclick="addCFirm()"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回" onclick="window.location.href='cflist'"/>
    </li>
  </ul>
</div>
</body>
</html>
